#ifndef CONSTANTS_H
#define CONSTANTS_H

#include <QString>


enum class MessageType
{
    LoginRequest,   // 登录请求
    LoginResponse,  // 登录回应
    RegisterRequest,    // 注册请求
    RegisterResponse,   // 注册回应
    LogoutRequest,  // 登出请求
    LogoutResponse, // 登出回应
    SearchUserRequest,  // 搜索用户请求
    SearchUserResponse, // 搜索用户回应
    ApplyFriendRequestToServer, // 客户端发给服务器端的申请好友请求
    ApplyFriendRequestToClient, // 服务器转发给客户端的申请好友请求
    ApplyFriendResponseToServer,    // 客户端发给服务器端的申请好友审核结果
    ApplyFriendResponseToClient,    // 服务器转发给客户端的申请好友审核结果
    GetFriendApplication,   // 从服务器获取到好友申请转发
    GetFriendApplicationResult, // 从服务器获取到了好友申请审核结果
    RequestDataBuffer,  // 申请数据库缓存
    ChatMessageToServer,    // 用户发送给服务器的聊天消息
    ChatMessageToClient,    // 服务器转发给用户的聊天消息
    GetChatMessageFromServer,   // 用户从服务器得到转发的聊天消息
    VideoRequestToServer,   // 客户端请求服务器转发视频通话请求
    VideoRequestToClient,   // 服务器转发客户端视频通话请求
    VideoResponseToServer,  // 客户端回应其他用户视频通话请求
    VideoResponseToClient,  // 服务器转发视频通话请求结果
    VideoCallFinished,  // 客户端服务器互相通知视频通话结束

    Unknown // 未知类型，不做解析

};
enum class ContentType
{
    MESSAGE,    // 消息类型
    IMAGE,  // 图片类型
    OTHER   // 未知数据，不做解析
};

namespace JsonKey
{
    static const QString TYPE = "messageType";
    static const QString USER_ID = "userId";
    static const QString PASSWORD = "password";
    static const QString STATUS = "status";
    static const QString REASON = "reason";
    static const QString EMAIL = "email";
    static const QString NICKNAME = "nickname";
    static const QString FRIEND_ID = "friendId";
    static const QString ALIAS = "alias";
    static const QString VERIFY_INFO = "verifyInfo";
    static const QString CREATE_TIME = "createTime";
    static const QString ID = "id";
    static const QString CHAT_MSG = "chatMessage";
    static const QString SENDER_ID = "senderId";
    static const QString USER_IP = "userIp";
}

using Type = QString;
using UserId = QString;
using Password = QString;
using Status = QString;
using Reason = QString;
using Email =QString;
using Nickname = QString;
using FriendId = QString;
using Alias = QString;
using VerifyInfo = QString;
using CreateTime = QString;
using Id = int;
using ChatMessage = QString;
using SenderId = QString;
using Ip = QString;

namespace JsonValue
{
    static const QString STATUS_SUCCESS = "success";    // 登录回复 注册回复
    static const QString STATUS_FAILURE = "failure";    // 登录回复 注册回复
    static const QString STATUS_ACCEPTED = "accepted";  // 同意好友申请
    static const QString STATUS_REJECTED = "rejected";  // 拒绝好友申请
    static const QString STATUS_BUSY = "busy";  // 当前正忙 用于视频通话请求回复
    static const QString STATUS_OFFLINE = "offline";  // 对方不在线 用于视频通话请求回复
    static const QString STATUS_NETWORK_ERROR = "network error";  // 网络异常 一般用于视频通话网卡检测失败
    static const QString REASON_SUCCESS = "verified pass";  // 登录回复
    static const QString REASON_FAILURE_UNKNOWN_ERROR = "unknown error";  // 登录回复 注册回复
    static const QString REASON_FAILURE_NO_USERID = "not found userId"; // 登录回复
    static const QString REASON_FAILURE_PWD_WRONG = "password wrong";   // 登录回复
    static const QString REASON_FAILURE_ALREADY_ONLINE = "already online";  // 登录回复
    static const QString REASON_FAILURE_EMAIL_ALREADY_EXISTS = "email already exists";  // 注册回复

}


enum class FriendVerifyStatus{
    Unverified, // 未审核该申请
    Accpeted,   // 接受好友申请
    Rejected    // 拒绝好友申请
};



#endif // CONSTANTS_H
